import gdata.docs.service
import getpass
import sys

try:
    user = sys.argv[1]
except IndexError:
    print "Supply a user name as the first command line argument.\n"
    sys.exit(1)
print "user: " + user + "\n"

# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.docs.service.DocsService()
# Authenticate using your Google Docs email address and password.
client.ClientLogin(user, getpass.getpass())

# Query the server for an Atom feed containing a list of your documents.
documents_feed = client.GetDocumentListFeed()
# Loop through the feed and extract each document entry.
for document_entry in documents_feed.entry:
  # Display the title of the document on the command line.
  print document_entry.title.text
